Allocating and Preparing MIDI Data Blocks

The midiOutLongMsg10239RN, midiInAddBufferX_0FK6, and midiStreamOut060OP9 functions require that applications to allocate data blocks to pass to the device drivers for playback or recording purposes. Each of these functions uses a MIDIHDR8OW3.JO structure to describe its data block.

Before you use one of these functions to pass a data block to a device driver, you must allocate memory for the buffer and the header structure that describes the data block.

Windows provides the following functions for preparing and cleaning up MIDI data blocks:

midiInPrepareHeader.S.Q5D

Prepares a MIDI input data block.

midiInUnprepareHeader1W1LZ7.

Cleans up the preparation of a MIDI input data block.

midiOutPrepareHeaderC2JN6Y

Prepares a MIDI output data block.

midiOutUnprepareHeader17F.LWX

Cleans up the preparation of a MIDI output data block.

 

Before you pass a MIDI data block to a device driver, you must prepare the buffer by passing it to the midiInPrepareHeader.S.Q5D or midiOutPrepareHeaderC2JN6Y function. When the device driver is finished with the buffer and returns it, you must clean up this preparation by passing the buffer to the midiInUnprepareHeader1W1LZ7. or midiOutUnprepareHeader17F.LWX function before any allocated memory can be freed.